const router = require('koa-router')()
const mongoose = require('mongoose')

const Image = mongoose.model('Image')

router.get('/', async (ctx, next) => {
  const images = await Image.find({})
    .sort({createdAt: -1}).limit(20)

  await ctx.render('index', {
    title: '图片共享', images
  })
})

module.exports = router
